# Copyright 2024-2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

package(
    default_visibility = ["//ink/rendering/skia/native:__subpackages__"],
)

cc_library(
    name = "mesh_uniform_data",
    srcs = ["mesh_uniform_data.cc"],
    hdrs = ["mesh_uniform_data.h"],
    deps = [
        "//ink/brush:brush_paint",
        "//ink/color",
        "//ink/color:color_space",
        "//ink/geometry:affine_transform",
        "//ink/geometry:mesh_format",
        "//ink/geometry:mesh_packing_types",
        "//ink/rendering/skia/common_internal:mesh_specification_data",
        "@com_google_absl//absl/functional:function_ref",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/log:absl_log",
        "@com_google_absl//absl/types:span",
        "@skia//:core",
    ],
)

cc_test(
    name = "mesh_uniform_data_test",
    srcs = ["mesh_uniform_data_test.cc"],
    deps = [
        ":mesh_uniform_data",
        "//ink/color",
        "//ink/color:color_space",
        "//ink/color:type_matchers",
        "//ink/geometry:affine_transform",
        "//ink/geometry:angle",
        "//ink/geometry:mesh_format",
        "//ink/geometry:mesh_packing_types",
        "//ink/geometry:type_matchers",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status:statusor",
        "@com_google_googletest//:gtest_main",
        "@skia//:core",
    ],
)

cc_library(
    name = "create_mesh_specification",
    srcs = ["create_mesh_specification.cc"],
    hdrs = ["create_mesh_specification.h"],
    deps = [
        "//ink/rendering/skia/common_internal:mesh_specification_data",
        "//ink/types:small_array",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/log:absl_log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:str_format",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_absl//absl/types:span",
        "@skia//:core",
    ],
)

cc_test(
    name = "create_mesh_specification_test",
    srcs = ["create_mesh_specification_test.cc"],
    deps = [
        ":create_mesh_specification",
        "//ink/geometry:mesh_format",
        "//ink/rendering/skia/common_internal:mesh_specification_data",
        "//ink/strokes/internal:stroke_vertex",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_googletest//:gtest_main",
        "@skia//:core",
    ],
)

cc_library(
    name = "mesh_drawable",
    srcs = ["mesh_drawable.cc"],
    hdrs = ["mesh_drawable.h"],
    deps = [
        ":mesh_uniform_data",
        "//ink/brush:brush_paint",
        "//ink/brush:color_function",
        "//ink/color",
        "//ink/geometry:affine_transform",
        "@com_google_absl//absl/container:inlined_vector",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_absl//absl/types:span",
        "@skia//:core",
    ],
)

cc_test(
    name = "mesh_drawable_test",
    srcs = ["mesh_drawable_test.cc"],
    deps = [
        ":create_mesh_specification",
        ":mesh_drawable",
        ":mesh_uniform_data",
        "//ink/rendering/skia/common_internal:mesh_specification_data",
        "//ink/strokes/internal:stroke_vertex",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
        "@skia//:core",
    ],
)

cc_library(
    name = "mesh_specification_cache",
    srcs = ["mesh_specification_cache.cc"],
    hdrs = ["mesh_specification_cache.h"],
    deps = [
        ":create_mesh_specification",
        "//ink/geometry:mesh_format",
        "//ink/geometry:partitioned_mesh",
        "//ink/rendering/skia/common_internal:mesh_specification_data",
        "//ink/strokes:in_progress_stroke",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@skia//:core",
    ],
)

cc_test(
    name = "mesh_specification_cache_test",
    srcs = ["mesh_specification_cache_test.cc"],
    deps = [
        ":mesh_specification_cache",
        "//ink/brush",
        "//ink/brush:brush_family",
        "//ink/brush:brush_paint",
        "//ink/brush:brush_tip",
        "//ink/color",
        "//ink/geometry:mesh_format",
        "//ink/geometry:mesh_test_helpers",
        "//ink/geometry:partitioned_mesh",
        "//ink/strokes:in_progress_stroke",
        "//ink/strokes:stroke",
        "//ink/strokes/input:stroke_input_batch",
        "//ink/types:duration",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_googletest//:gtest_main",
        "@skia//:core",
    ],
)

cc_library(
    name = "path_drawable",
    srcs = ["path_drawable.cc"],
    hdrs = ["path_drawable.h"],
    deps = [
        "//ink/brush:color_function",
        "//ink/color",
        "//ink/color:color_space",
        "//ink/geometry:mesh",
        "//ink/geometry:mesh_index_types",
        "//ink/geometry:mutable_mesh",
        "//ink/geometry:partitioned_mesh",
        "//ink/geometry:point",
        "@com_google_absl//absl/container:inlined_vector",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/types:span",
        "@skia//:core",
    ],
)

cc_library(
    name = "shader_cache",
    srcs = ["shader_cache.cc"],
    hdrs = ["shader_cache.h"],
    deps = [
        "//ink/brush:brush_paint",
        "//ink/color",
        "//ink/color:color_space",
        "//ink/geometry:affine_transform",
        "//ink/rendering/skia/native:texture_bitmap_store",
        "//ink/strokes/input:stroke_input_batch",
        "@com_google_absl//absl/base:nullability",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/log:absl_log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@skia//:core",
    ],
)

cc_test(
    name = "shader_cache_test",
    srcs = ["shader_cache_test.cc"],
    deps = [
        ":shader_cache",
        "//ink/brush:brush_paint",
        "//ink/brush:fuzz_domains",
        "//ink/rendering/skia/native:texture_bitmap_store",
        "//ink/strokes/input:fuzz_domains",
        "//ink/strokes/input:stroke_input_batch",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_absl//absl/types:span",
        "@com_google_fuzztest//fuzztest",
        "@com_google_googletest//:gtest_main",
        "@skia//:core",
    ],
)
